package com.example.modelfunction.shrio.usermanager.mode;

import com.example.base.model.BaseEntity;
import com.example.util.annotation.invisiable;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

@Entity
@Table(name = "user")
public class User extends BaseEntity implements Serializable{

	private static final long serialVersionUID = -9154151450445716679L;

	public static final Integer STATUS_NORMAL = 0;

	public static final Integer STATUS_FREEZE = 1;

	// 实名验证状态
	public static final Integer VALID_NOT = 1;// 未验证

	public static final Integer VALID_FIRST = 2;// 第一次验证

	public static final Integer VALID_SECOND = 3;// 第二次验证

	public static final Integer VALID_LOCK = 4;// 锁住

	public static final Integer VALID_VERIFIED = 5;// 已验证


	@invisiable
	@Column(name = "name")
	private String name;// 用户名
	@invisiable
	@Column(name = "id_card")
	private String idCard;// 身份证号

	@Column(name = "account")
	private String account;// 账号

	@Column(name = "pwd")
	private String pwd;// 密码

	@Column(name = "pwd_salt")
	private String pwdSalt;//

	@Column(name = "agent_id")
	private Integer agentId;// 代理商id

	@Column(name = "role_id")
	private Integer roleId;// 角色id

	@Column(name = "company_name")
	private String companyName;// 公司名称

	@Column(name = "contact")
	private String contact;// 联系人

	@Column(name = "tel")
	private String tel;// 联系电话

	@Column(name = "email")
	private String email;// 邮箱

	@Column(name = "address")
	private String address;// 联系地址

	@Column(name = "status")
	private Integer status;// 0正常1冻结

	@Column(name = "valid_status")
	private Integer validStatus;// 实名验证状态(1:未验证,2:第一次验证,3第二次验证,4锁住,5已验证)默认1

	@Column(name = "machine_count")
	private Integer machineCount;// 设备数量

	@Column(name = "access_token")
	private String accessToken;// token

	@Column(name = "sex")
	private Integer sex;// 性别

	@Column(name = "openid")
	private String openid;//

	@Column(name = "head_img", length = 150)
	private String headImg;// 微信用户头像链接

	@Column(name = "nick_name", length = 50)
	private String nickName;// 微信用户昵称

	public User() {
	}

	public User(String account) {
		super();
		this.account = account;
	}



	public String getName() {

		return this.name;
	}

	public void setName(String name) {

		this.name = name;
	}

	public String getAccount() {

		return this.account;
	}

	public void setAccount(String account) {

		this.account = account;
	}

	public String getPwd() {

		return this.pwd;
	}

	public void setPwd(String pwd) {

		this.pwd = pwd;
	}

	public String getPwdSalt() {

		return this.pwdSalt;
	}

	public void setPwdSalt(String pwdSalt) {

		this.pwdSalt = pwdSalt;
	}

	public Integer getAgentId() {

		return this.agentId;
	}

	public void setAgentId(Integer agentId) {

		this.agentId = agentId;
	}

	public Integer getRoleId() {

		return this.roleId;
	}

	public void setRoleId(Integer roleId) {

		this.roleId = roleId;
	}

	public String getCompanyName() {

		return this.companyName;
	}

	public void setCompanyName(String companyName) {

		this.companyName = companyName;
	}

	public String getContact() {

		return this.contact;
	}

	public void setContact(String contact) {

		this.contact = contact;
	}

	public String getTel() {

		return this.tel;
	}

	public void setTel(String tel) {

		this.tel = tel;
	}

	public String getEmail() {

		return this.email;
	}

	public void setEmail(String email) {

		this.email = email;
	}

	public String getAddress() {

		return this.address;
	}

	public void setAddress(String address) {

		this.address = address;
	}

	public Integer getStatus() {

		return this.status;
	}

	public void setStatus(Integer status) {

		this.status = status;
	}

	public Integer getMachineCount() {

		return this.machineCount;
	}

	public void setMachineCount(Integer machineCount) {

		this.machineCount = machineCount;
	}

	public String getAccessToken() {

		return this.accessToken;
	}

	public void setAccessToken(String accessToken) {

		this.accessToken = accessToken;
	}

	public Integer getSex() {

		return this.sex;
	}

	public void setSex(Integer sex) {

		this.sex = sex;
	}

	public String getOpenid() {

		return this.openid;
	}

	public void setOpenid(String openid) {

		this.openid = openid;
	}
	public String getHeadImg() {

		return headImg;
	}

	public void setHeadImg(String headImg) {

		this.headImg = headImg;
	}

	public String getNickName() {

		return nickName;
	}

	public void setNickName(String nickName) {

		this.nickName = nickName;
	}

	public String getIdCard() {

		return idCard;
	}

	public void setIdCard(String idCard) {

		this.idCard = idCard;
	}

	public Integer getValidStatus() {

		return validStatus;
	}

	public void setValidStatus(Integer validStatus) {

		this.validStatus = validStatus;
	}
    public Boolean isValidate()
	{

		return status==0&&(validStatus==null||validStatus!=4);
	}
	/*@Override
	public String toString() {
		return " [id=" + getId() + ", name=" + name + ", account=" + account + ", agentId=" + agentId + ", contact=" + contact + ", tel=" + tel + ", status=" + status + ", accessToken=" + accessToken + "]";
	}*/
}
